package com.yilin.platform.controller.capital;


import com.yilin.platform.base_core.application.BaseController;
import com.yilin.platform.base_core.application.PageData;
import com.yilin.platform.base_core.application.ReturnData;
import com.yilin.platform.base_core.commons.annotation.SkipLoginVerify;
import com.yilin.platform.base_core.commons.utils.ParamUtil;
import com.yilin.platform.base_core.commons.utils.StringUtil;
import com.yilin.platform.entity.capital.AdvanceMoney;
import com.yilin.platform.entity.capital.Book;
import com.yilin.platform.entity.truck.TruckVehicle;
import com.yilin.platform.entity.user.Account;
import com.yilin.platform.mapper.capital.BookMapper;
import com.yilin.platform.service.impl.capital.AdvanceMoneyService;
import com.yilin.platform.service.impl.capital.BookService;
import com.yilin.platform.service.impl.truck.TruckVehicleService;
import com.yilin.platform.service.impl.user.AuthorityService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/capital/book/")
public class BookController extends BaseController {
    @Resource
    private BookService bookService;


    @PostMapping("saveBook")
    public  ReturnData<Object> saveBook(Book book){
        Account account=getLoginUser();
        ParamUtil.isNull(book.getName(),"书名不能为空");
        ParamUtil.isNull(book.getBookNo(),"表闹不能为空");
        bookService.saveBook(book,account);
        return jsonView(true, "保存成功");
    }
    @PostMapping("getById")
    public  ReturnData<Object> getById(String id){
        ParamUtil.isNull(id,"id不能为空");
        Book book= bookService.getById(id);
        return jsonView(true, "保存成功",book);
    }
}
